/**
 * \file driver/net/rs232.h
 * \author Davide Gessa
 * \date 12-05-2009
 */
#ifndef RS232_H
#define RS232_H

#include <types.h>
#include <driver.h>


#define IRQ_COM24		3
#define IRQ_COM13		4

#define COM1 0x3f8
#define COM2 COM1 + 1
#define COM3 COM2 + 1
#define COM4 COM3 + 1

extern driver_t driver_rs232;

typedef struct
{
	char buf[256];
	uint8_t size;
	uint8_t where;
	uint8_t point;	
} rs232_buf_t;


rs232_buf_t combuf[4];

uint32_t rs232_init();
void rs232_init_port(uint32_t);
void rs232_send(uint32_t, uint8_t);
uint8_t rs232_receive(uint32_t);
static void rs232_callback(regs_t *);
uint32_t rs232_recv_frame(char *, uint32_t);
uint32_t rs232_send_frame(char *, uint32_t);
uint32_t rs232_probe(device_t *);

#endif
